﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Globalization;

namespace tmsWeb
{
    public partial class Main : System.Web.UI.MasterPage
    {
        public string appRoot;
        protected void Page_Load(object sender, EventArgs e)
        {
            appRoot = micsun.Web.ApplicationBase.GetUrlRoot();
            InitializeResources();
        }

        private void InitializeResources()
        {

            //lbFirst.NavigateUrl = Transfer.GetUrlRoot();
            string mainPath = Transfer.GetUrlRoot();
            lbFirst.Text = "主页";
            lbFirst.Attributes.Add("onmouseover", "this.style.cursor = 'hand'");
            lbFirst.NavigateUrl = Transfer.GetUrlRoot() + micsun.Logic.micsunConfiguration.NamedPage["home"].ToString();//"default.aspx";

            //lbLogout.NavigateUrl = Transfer.GetUrlRoot()+"/Logout.aspx";			
            string logoutPath = "Logout.aspx";
            lbLogout.Text = "登出";
            lbLogout.Attributes.Add("onmouseover", "this.style.cursor = 'hand'");
            lbLogout.NavigateUrl = logoutPath;

            string url = Server.UrlEncode(Request.Url.ToString());
            //lbChgPwd.NavigateUrl = Transfer.GetUrlRoot()+"/ChangePasswd.aspx?ReturnUrl="+url;
            //string changePwdPath = Transfer.GetUrlRoot() + "/ChangePasswd.aspx?ReturnUrl=" + url;
            //lbChgPwd.Text	= ResourcesTable.PAG_CHGPWD;
            //lbChgPwd.Attributes.Add( "onmouseover","this.style.cursor = 'hand'" );
            //lbChgPwd.Attributes.Add( "onclick","document.location='" + changePwdPath + "'" );


            //	if( ApplicationConfiguration.EnableDynamicHelp )
            //		lbHelp.NavigateUrl = "javascript:OpenHelp()";

            //lbAbout.NavigateUrl = Transfer.GetUrlRoot()+"/About.aspx";			
            string aboutpath = Transfer.GetUrlRoot() + "About.aspx";
            lbAbout.Text = "关于";
            lbAbout.Attributes.Add("onmouseover", "this.style.cursor = 'hand'");
            lbAbout.NavigateUrl = aboutpath;


            micsun.Web.PageBase page = this.Page as micsun.Web.PageBase;
            if (page != null && page.User != null)
                lbLogonUserName.Text = this.Page.Server.HtmlEncode(page.User.UserName);
            else
                lbLogonUserName.Text = "未登录";

            //CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
            //lbDate.Text = DateTime.Now.ToString();



        }
    }
}
